#pragma once

#include <QScopedPointer>
#include <QWidget>
#include "tasks/task.h"

namespace Ui {
class ISOMode;
}

class ISOModePrivate;
class ISOMode : public QWidget
{
    Q_OBJECT

public:
    enum class SaveMode {
        Directory = 0,
        Docker,
    };

    explicit ISOMode(QWidget *parent = nullptr);
    ~ISOMode();

protected:
    void changeEvent(QEvent *e);

private Q_SLOTS:
    void UpdateUI();
    void OnLogClearClicked();
    void OnISOBrowseClicked();
    void OnISOTextEditingFinished();
    void OnProjectDirBrowseClicked();
    void OnProjectDirTextEditingFinished();
    void OnSaveDirBrowseClicked();
    void OnSaveDirTextEditingFinished();
    void OnSaveModeToggle(bool toggle);
    void OnSaveClearClicked();
    void OnBuildClicked();
    void OnOpenTerminalClicked();

    // Tasks
    void OnTaskQueueAllDone(bool success);
    void OnTaskStarted(const TaskData &data);
    void OnTaskFinished(const TaskData &data, int exitcode, const QString &errstr = QString());
    void OnTaskError(const TaskData &data, const QString &contents);
    void OnTaskOutput(const TaskData &data, const QString &contents);

private:
    Ui::ISOMode *ui;
    const QScopedPointer<ISOModePrivate> d_ptr;
    Q_DECLARE_PRIVATE(ISOMode)
};
